//
// Created by longyunbo on 6/23/21.
//

#include "InstanceKlass.h"

InstanceKlass::~InstanceKlass(){

//    if( constantPool == nullptr ){
//        delete constantPool;
//    }
//    if( methodInfo == nullptr ){
//        delete methodInfo;
//    }

};

InstanceKlass::InstanceKlass(){

}

//设置魔术
void InstanceKlass::set_magic( int value ){
    _magic = value;
};
//得到魔术
int InstanceKlass::get_magic(){
    return _magic;
};

ConstantPool* InstanceKlass::get_constantPool(){
    return _constantPool;
};
void InstanceKlass::set_constantPool( ConstantPool* value ){
    _constantPool = value;
};
list<InterfaceInfo*> InstanceKlass::getInterfaceInfo(){
    return interfaceInfo;
};
void InstanceKlass::setInterfaceInfo( list<InterfaceInfo*> value ){
    interfaceInfo  = value;
};

list<FieldInfo*> InstanceKlass::getFieldInfo(){
    return fieldInfo;
};
void InstanceKlass::setFieldInfo( list<FieldInfo*> value ){
    fieldInfo = value;
};

//得到方法
MethodInfo* InstanceKlass::getMethodInfo(){
    return methodInfo;
};

//MemoryChunk *MemoryChunk::set_used_cell_num(uint val)
//{
//    m_used_cell_num = val;
//
//    return this;
//}

void InstanceKlass::setMethodInfo(MethodInfo* value , int index ){
    methodInfo[index] = (*value);
//    return this;
};


//初始化方法
void InstanceKlass::initMethodInfo(){
    methodInfo = new MethodInfo[getmethodLength()];
};
